home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Resources / Online / Term / Extras / Source / gtlayout-source.lha / gtlayout_internal.h < prev    next >
C/C++ Source or Header  |  1996-10-08  |  22KB  |  1,006 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1996 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. */
  7.  
  8. #ifndef _GTLAYOUT_INTERNAL_H
  9. #define _GTLAYOUT_INTERNAL_H 1
  10.  
  11.     // Debugging stuff
  12.  
  13. #ifdef DEBUG
  14. #define DB(x)    x
  15. #else
  16. #define DB(x)    ;
  17. #endif    /* DEBUG */
  18.  
  19.     // Keep this one handy
  20.  
  21. VOID kprintf(STRPTR,...);
  22.  
  23. /*****************************************************************************/
  24.  
  25.  
  26.     // Keyboard qualifiers
  27.  
  28. #define QUALIFIER_SHIFT     (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT)
  29. #define QUALIFIER_ALT        (IEQUALIFIER_LALT | IEQUALIFIER_RALT)
  30. #define QUALIFIER_CONTROL    (IEQUALIFIER_CONTROL)
  31.  
  32.  
  33. /*****************************************************************************/
  34.  
  35.  
  36.     // Undefine these to remove various chunks of support from this code
  37.  
  38. #ifdef _GTLAYOUT_GLOBAL_H
  39. #define DO_PASSWORD_KIND
  40. #define DO_GAUGE_KIND
  41. #define DO_TAPEDECK_KIND
  42. #define DO_HEXHOOK
  43. #define DO_PICKSHORTCUTS
  44. #define DO_CLONING
  45. #define DO_LEVEL_KIND
  46. #define DO_BOOPSI_KIND
  47. #define DO_MENUS
  48. #define DO_POPUP_KIND
  49. #define DO_TAB_KIND
  50. #else
  51. #define DO_PASSWORD_KIND
  52. #define DO_GAUGE_KIND
  53. #define DO_CLONING
  54. #define DO_BOOPSI_KIND
  55. #define DO_POPUP_KIND
  56. #endif    // _GTLAYOUT_GLOBAL_H
  57.  
  58.  
  59. /*****************************************************************************/
  60.  
  61.  
  62. APTR ASM AsmCreatePool(REG(d0) ULONG MemFlags,REG(d1) ULONG PuddleSize,REG(d2) ULONG ThreshSize,REG(a6) struct ExecBase *SysBase);
  63. VOID ASM AsmDeletePool(REG(a0) APTR PoolHeader,REG(a6) struct ExecBase *SysBase);
  64. APTR ASM AsmAllocPooled(REG(a0) APTR PoolHeader,REG(d0) ULONG Size,REG(a6) struct ExecBase *SysBase);
  65. VOID ASM AsmFreePooled(REG(a0) APTR PoolHeader,REG(a1) APTR Memory,REG(d0) ULONG MemSize,REG(a6) struct ExecBase *SysBase);
  66.  
  67.  
  68. /*****************************************************************************/
  69.  
  70.  
  71.     // Scan an Exec list
  72.  
  73. #define SCANLIST(l,n)    for(n = (APTR)((struct MinList *)l) -> mlh_Head; \
  74.             ((struct MinNode *)n) -> mln_Succ; \
  75.             n = (APTR)((struct MinNode *)n) -> mln_Succ)
  76.  
  77.     // Scan the objects of a group
  78.  
  79. #define SCANGROUP(g,n)    for(n = (APTR)g -> Special . Group . ObjectList . mlh_Head; \
  80.             ((struct MinNode *)n) -> mln_Succ; \
  81.             n = (APTR)((struct MinNode *)n) -> mln_Succ)
  82.  
  83.     // Scan the objects of a group, only allowing active pages
  84.  
  85. #define SCANPAGE(g,n,p) for(p = 0, n = (APTR)g -> Special . Group . ObjectList . mlh_Head; \
  86.             ((struct MinNode *)n) -> mln_Succ; \
  87.             n = (APTR)((struct MinNode *)n) -> mln_Succ) \
  88.             if ((p++ == g -> Special . Group . ActivePage) || !g -> Special . Group . Paging)
  89.  
  90.     // Get an object pointer from a gadget pointer
  91.  
  92. #define GETOBJECT(g,n)    ((n = (ObjectNode *)g -> UserData) && (n -> Host == g) && (n -> PointBack == n))
  93.  
  94.  
  95. /*****************************************************************************/
  96.  
  97.  
  98. #ifdef DO_PASSWORD_KIND
  99. #define TEST_PASSWORD_KIND(n) || (n -> Type == PASSWORD_KIND)
  100. #else
  101. #define TEST_PASSWORD_KIND(n) || (FALSE)
  102. #endif
  103.  
  104.     // Is an object derived from STRING_KIND?
  105.  
  106. #define LIKE_STRING_KIND(n)    ((n -> Type == STRING_KIND) TEST_PASSWORD_KIND(n))
  107.  
  108.  
  109. /*****************************************************************************/
  110.  
  111.  
  112. #define NUMELEMENTS(s)        (sizeof(s) / sizeof((s)[0]))
  113.  
  114.  
  115. /*****************************************************************************/
  116.  
  117.  
  118. typedef char BOOLEAN;
  119.  
  120. #define INCREMENTER_KIND    42
  121. #define PICKER_KIND        43
  122. #define GROUP_KIND        44
  123.  
  124. #define LAPR_Gadget        TAG_USER+100
  125. #define LAPR_Object        TAG_USER+101
  126.  
  127. typedef struct GaugeExtra
  128. {
  129.     LONG             InfoLength;
  130.     STRPTR             InfoText;
  131.     WORD             LastPercentage;
  132.     BOOLEAN             NoTicks;
  133.     BOOLEAN             Discrete;
  134. } GaugeExtra;
  135.  
  136. typedef struct TapeDeckExtra
  137. {
  138.     struct Image        *ButtonImage;
  139.     LONG             ButtonWidth,
  140.                  ButtonHeight;
  141.     BOOLEAN          ButtonType;
  142.     BOOLEAN             Toggle;
  143.     BOOLEAN             Smaller;
  144.     BOOLEAN             Tick;
  145. } TapeDeckExtra;
  146.  
  147. typedef struct ButtonExtra
  148. {
  149.     struct Image        *ButtonImage;
  150.     STRPTR             KeyStroke;
  151.     STRPTR            *Lines;
  152.     UBYTE             LineCount;
  153.  
  154.     BOOLEAN          ReturnKey;
  155.     BOOLEAN          EscKey;
  156.     BOOLEAN          ExtraFat;
  157.     BOOLEAN             DefaultCorrection;
  158.     BOOLEAN             Smaller;
  159. } ButtonExtra;
  160.  
  161. typedef struct BarExtra
  162. {
  163.     struct ObjectNode    *Parent;
  164.     BOOLEAN          FullSize;
  165. } BarExtra;
  166.  
  167. typedef struct BoxExtra
  168. {
  169.     struct ObjectNode    *Parent;
  170.     STRPTR            *Labels;
  171.     STRPTR            *Lines;
  172.     WORD             MaxSize;
  173.     BYTE             AlignText;
  174.     BOOLEAN          DrawBox;
  175.     BOOLEAN          ReserveSpace;
  176. } BoxExtra;
  177.  
  178. typedef struct FrameExtra
  179. {
  180.     struct Hook        *RefreshHook;
  181.     UWORD             InnerWidth;
  182.     UWORD             InnerHeight;
  183.     struct Gadget         Dummy;
  184.     BOOLEAN          DrawBox;
  185.     BOOLEAN             GenerateEvents;
  186. } FrameExtra;
  187.  
  188. typedef struct PickerExtra
  189. {
  190.     struct Gadget        *Parent;    // Important: must match IncrementerExtra!
  191.     struct Image        *Image;        // Important: must match IncrementerExtra!
  192. } PickerExtra;
  193.  
  194. typedef struct IncrementerExtra
  195. {
  196.     struct Gadget        *Parent;    // Important: must match PickerExtra!
  197.     struct Image        *Image;        // Important: must match PickerExtra!
  198.     LONG             Amount;
  199. } IncrementerExtra;
  200.  
  201. typedef struct GroupExtra
  202. {
  203.     struct MinList         ObjectList;
  204.     struct ObjectNode    *ParentGroup;
  205.     LONG             MaxOffset;
  206.     LONG             MaxSize;
  207.     ULONG             ActivePage;
  208. #ifdef NOT_FUNCTIONAL
  209.     LONG             UseWidth;
  210.     LONG             UseHeight;
  211. #endif    // NOT_FUNCTIONAL
  212.     UWORD             ExtraLeft;
  213.     UWORD             ExtraTop;
  214.     UBYTE             MiscFlags;
  215.     BOOLEAN          Horizontal;
  216.     BOOLEAN          Paging;
  217.     BOOLEAN          Spread;
  218.     BOOLEAN          SameSize;
  219.     BOOLEAN          LastAttributes;
  220.     BOOLEAN          Visible;
  221.     BOOLEAN             Frame;
  222.     BOOLEAN             IndentX;
  223.     BOOLEAN             IndentY;
  224.     BOOLEAN             NoIndent;
  225. } GroupExtra;
  226.  
  227. #define GROUPF_WidthDone    (1<<0)
  228. #define GROUPF_HeightDone    (1<<1)
  229.  
  230. typedef struct ListExtra
  231. {
  232.     struct List        *Labels;
  233.     struct Gadget        *Link;
  234.     LONG             LinkID;
  235.     struct Hook        *CallBack;
  236.     LONG             AutoPageID;
  237.     struct TextAttr        *TextAttr;
  238.     STRPTR            *ExtraLabels;
  239.     UWORD             ExtraLabelWidth;
  240.     UWORD             MaxPen;
  241.     UWORD             MaxGrowX,MaxGrowY;
  242.     UWORD             MinChars,MinLines;
  243.     WORD             FixedGlyphWidth;
  244.     WORD             FixedGlyphHeight;
  245.     BOOLEAN          ReadOnly;
  246.     BOOLEAN          CursorKey;
  247.     BOOLEAN          AllocatedList;
  248.     BOOLEAN             LockSize;
  249.     BOOLEAN             SizeLocked;
  250.     BOOLEAN             ResizeX;
  251.     BOOLEAN             ResizeY;
  252.     BOOLEAN             FlushLabelLeft;
  253.     BOOLEAN             IgnoreListContents;
  254. } ListExtra;
  255.  
  256. typedef struct RadioExtra
  257. {
  258.     STRPTR            *Choices;
  259.     LONG             AutoPageID;
  260.     UWORD             LabelWidth;
  261.     UBYTE             TitlePlace;
  262.     BOOLEAN             TabKey;
  263. } RadioExtra;
  264.  
  265. typedef struct TextExtra
  266. {
  267.     STRPTR             Text;
  268.     struct Gadget        *Picker;
  269.     WORD             FrontPen;
  270.     WORD             BackPen;
  271.     UWORD             Len;
  272.     UBYTE             Justification;
  273.     BOOLEAN          Border;
  274.     BOOLEAN          CopyText;
  275.     BOOLEAN          UsePicker;
  276.     BOOLEAN             LockSize;
  277.     BOOLEAN             SizeLocked;
  278. } TextExtra;
  279.  
  280. typedef struct NumberExtra
  281. {
  282.     LONG             Number;
  283.     STRPTR             Format;
  284.     WORD             FrontPen;
  285.     WORD             BackPen;
  286.     WORD             MaxNumberLen;
  287.     UBYTE             Justification;
  288.     BOOLEAN          Border;
  289. } NumberExtra;
  290.  
  291. typedef struct CycleExtra
  292. {
  293.     STRPTR            *Choices;
  294.     LONG             AutoPageID;
  295.     BOOLEAN             TabKey;
  296. } CycleExtra;
  297.  
  298. typedef struct PalExtra
  299. {
  300.     UBYTE            *ColourTable;
  301.     UBYTE            *TranslateBack;
  302.     struct Gadget        *Picker;
  303.     UWORD             Depth;
  304.     UWORD             NumColours;
  305.     UWORD             IndicatorWidth;
  306.     BOOLEAN          SmallPalette;
  307.     BOOLEAN             UsePicker;
  308. } PalExtra;
  309.  
  310. typedef struct SliderExtra
  311. {
  312.     STRPTR             LevelFormat;
  313.     DISPFUNC         DispFunc;
  314.     LONG             MaxLevelLen;
  315.     LONG             LevelWidth;
  316.     STRPTR             OriginalLabel;
  317.     UBYTE             LevelPlace;
  318.     BOOLEAN          FullLevelCheck;
  319. } SliderExtra;
  320.  
  321. typedef struct StringExtra
  322. {
  323.     struct LayoutHandle    *LayoutHandle;
  324.     struct Hook        *HistoryHook;
  325.     ULONG             MaxHistoryLines;
  326.     ULONG             NumHistoryLines;
  327.     struct Node        *CurrentNode;
  328.  
  329.     STRPTR             String;
  330.     LONG             MaxChars;
  331.     struct Hook        *EditHook;
  332.     struct Hook        *ValidateHook;
  333.     struct Gadget        *Picker;
  334.     STRPTR             Backup;
  335.     STRPTR             RealString;
  336.     STRPTR             Original;
  337.     LONG             LinkID;
  338.  
  339.     UBYTE             Justification;
  340.     BOOLEAN          LastGadget;
  341.     BOOLEAN          UsePicker;
  342.     BOOLEAN             Activate;
  343. } StringExtra;
  344.  
  345. typedef struct IntegerExtra
  346. {
  347.     struct LayoutHandle    *LayoutHandle;
  348.     struct Hook        *HistoryHook;
  349.     ULONG             MaxHistoryLines;
  350.     ULONG             NumHistoryLines;
  351.     struct Node        *CurrentNode;
  352.  
  353.     struct Gadget        *LeftIncrementer;
  354.     struct Gadget        *RightIncrementer;
  355.  
  356.     struct Hook        *IncrementerHook;
  357.  
  358.     LONG             Number;
  359.     LONG             MaxChars;
  360.     struct Hook        *EditHook;
  361.     struct Hook        *ValidateHook;
  362.  
  363.     UBYTE             Justification;
  364.     BOOLEAN          LastGadget;
  365.     BOOLEAN          UseIncrementers;
  366.     BOOLEAN             CustomHook;
  367.     BOOLEAN             Activate;
  368. } IntegerExtra;
  369.  
  370. typedef struct ScrollerExtra
  371. {
  372.     WORD             Visible;
  373.     WORD             ArrowSize;
  374.     BOOLEAN          RelVerify;
  375.     BOOLEAN             Immediate;
  376.     BOOLEAN             Arrows;
  377.     BOOLEAN             Vertical;
  378.     BOOLEAN             Thin;
  379. } ScrollerExtra;
  380.  
  381. typedef struct LevelExtra
  382. {
  383.     struct LayoutHandle    *Handle;
  384.     LONG             Plus;
  385.     STRPTR             LevelFormat;
  386.     struct Image        *LevelImage;
  387.     DISPFUNC         DispFunc;
  388.     LONG             MaxLevelWidth,
  389.                  MidOffset,
  390.                  LevelPlace;
  391.     struct Hook         CustomHook;
  392.     UBYTE             FormatBuffer[80];
  393.     BOOLEAN             FullLevelCheck;
  394. } LevelExtra;
  395.  
  396. typedef struct BOOPSIExtra
  397. {
  398.     struct Library        *ClassBase;
  399.     Class            *ClassInstance;
  400.     STRPTR             ClassName;
  401.     STRPTR             ClassLibraryName;
  402.     struct TagItem        *ClassTags;
  403.     ULONG             TagCurrent,
  404.                  TagTextAttr,
  405.                  TagDrawInfo,
  406.                  TagLink,
  407.                  TagScreen;
  408.     LONG             Link;
  409.     struct ObjectNode    *Parent;
  410.     struct Hook        *ActivateHook;
  411.     WORD             ExactWidth,
  412.                  ExactHeight;
  413.     WORD             RelFontHeight;
  414.     BOOLEAN             FullWidth;
  415.     BOOLEAN             FullHeight;
  416. } BOOPSIExtra;
  417.  
  418. typedef struct PopupExtra
  419. {
  420.     STRPTR            *Choices;
  421.     LONG             AutoPageID;
  422.     BOOLEAN             TabKey;
  423.     BOOLEAN             CentreActive;
  424. } PopupExtra;
  425.  
  426. typedef struct TabExtra
  427. {
  428.     STRPTR            *Choices;
  429.     LONG             AutoPageID;
  430.     struct ObjectNode    *Parent;
  431.     BOOLEAN             TabKey;
  432.     BOOLEAN             FullWidth;
  433. } TabExtra;
  434.  
  435. typedef struct ObjectNode
  436. {
  437.     struct MinNode         Node;
  438.     struct Gadget        *Host;
  439.     struct ObjectNode    *PointBack;
  440.     STRPTR             Label;
  441.     LONG             ID;
  442.     LONG             Min;
  443.     LONG             Max;
  444.     LONG             Current;
  445.     APTR             Storage;
  446.  
  447.     UWORD             Left;
  448.     UWORD             Top;
  449.     UWORD             Width;
  450.     UWORD             Height;
  451.     UWORD             LabelWidth;
  452.     UWORD             Lines;
  453.     UWORD             Chars;
  454.     WORD             ExtraSpace;
  455.     WORD             LabelChars;
  456.  
  457.     UBYTE             Type;
  458.     BYTE             LabelPlace;
  459.     UBYTE             Key;
  460.     UBYTE             StorageType;
  461.     BYTE             Pad0;
  462.     BOOLEAN          Disabled;
  463.     BOOLEAN          NoKey;
  464.     BOOLEAN          HighLabel;
  465.     BOOLEAN          GroupIndent;
  466.     BOOLEAN          PageSelector;
  467.  
  468.     union
  469.     {
  470.         GaugeExtra        Gauge;
  471.         TapeDeckExtra        TapeDeck;
  472.         ButtonExtra        Button;
  473.         BarExtra        Bar;
  474.         BoxExtra        Box;
  475.         FrameExtra        Frame;
  476.         PickerExtra        Picker;
  477.         IncrementerExtra    Incrementer;
  478.         GroupExtra        Group;
  479.         ListExtra        List;
  480.         RadioExtra        Radio;
  481.         TextExtra        Text;
  482.         NumberExtra        Number;
  483.         CycleExtra        Cycle;
  484.         PalExtra        Palette;
  485.         SliderExtra        Slider;
  486.         StringExtra        String;
  487.         IntegerExtra        Integer;
  488.         ScrollerExtra        Scroller;
  489.         LevelExtra        Level;
  490.         BOOPSIExtra        BOOPSI;
  491.         PopupExtra        Popup;
  492.         TabExtra        Tab;
  493.     } Special;
  494. } ObjectNode;
  495.  
  496. typedef struct LayoutHandle
  497. {
  498.         // WARNING: Beginning of this structure must match the definition in gtlayout.h!
  499.  
  500.     struct Screen        *Screen;
  501.     struct DrawInfo     *DrawInfo;
  502.     struct Window        *Window;
  503.     APTR             VisualInfo;
  504.     struct Image        *AmigaGlyph;
  505.     struct Image        *CheckGlyph;
  506.     APTR             UserData;
  507.     struct Menu        *Menu;
  508.  
  509.         // End of public part
  510.  
  511.     struct Screen        *PubScreen;
  512.     struct MsgPort        *MsgPort;
  513.     struct Gadget        **GadgetArray;
  514.     struct Gadget        *Previous;
  515.     struct Gadget        *List;
  516.     ULONG             IDCMP;
  517.     ULONG             WA_ScreenTag;
  518.     BOOL             UnlockPubScreen;
  519.     BOOL             Pad1;
  520.  
  521.         // BOOPSI support
  522.  
  523.     Object            *BOOPSIPrevious;
  524.     Object            *BOOPSIList;
  525.  
  526.         // Incrementers
  527.  
  528.     ObjectNode        *ActiveIncrementer;
  529.     WORD             IncrementerCountdown;
  530.     WORD             IncrementerAccelerate;
  531.     LONG             IncrementerIncrement;
  532.  
  533.         // Frames
  534.  
  535.     ObjectNode        *ActiveFrame;
  536.  
  537.         // Cached from DrawInfo structure
  538.  
  539.     UWORD             TextPen;
  540.     UWORD             BackgroundPen;
  541.     UWORD             ShadowPen;
  542.     UWORD             ShinePen;
  543.  
  544.     UWORD             AspectX;
  545.     UWORD             AspectY;
  546.  
  547.         // Double-click support
  548.  
  549.     ULONG             ClickSeconds;
  550.     ULONG             ClickMicros;
  551.     ObjectNode        *ClickObject;
  552.  
  553.     struct Hook        *LocaleHook;
  554.     struct TextAttr     *TextAttr;
  555.     struct TextAttr     *InitialTextAttr;
  556.     struct TTextAttr     CopyTextAttr;
  557.     struct RastPort      RPort;
  558.  
  559.     APTR             Pool;
  560.  
  561.     UWORD             GlyphWidth;
  562.     UWORD             GlyphHeight;
  563.  
  564.     UWORD             InterWidth;
  565.     UWORD             InterHeight;
  566.  
  567.     LONG             Count;
  568.  
  569.     LONG             Index;
  570.  
  571.     ObjectNode        *TopGroup;
  572.     ObjectNode        *CurrentGroup;
  573.     ObjectNode        *EscKey;
  574.     ObjectNode        *ReturnKey;
  575.     ObjectNode        *CursorKey;
  576.     ObjectNode        *GrowView;
  577.     ObjectNode        *ResizeView;
  578.     ObjectNode        *TabKey;
  579.     ObjectNode        *ActiveString;
  580. #ifdef DO_PASSWORD_KIND
  581.     struct Hook         PasswordEditHook;
  582. #endif
  583. #ifdef DO_HEXHOOK
  584.     struct Hook         HexEditHook;
  585. #endif
  586.     struct Hook         DefaultEditHook;
  587.     struct Hook        *StandardEditHook;
  588.  
  589.     struct Hook         BackfillHook;
  590.     struct RastPort         BackfillRastPort;
  591.  
  592. #ifdef DO_LEVEL_KIND
  593.     ObjectNode        *CurrentLevel;
  594. #endif    /* DO_LEVEL_KIND */
  595.  
  596.     struct TTextAttr     FixedFont;
  597.  
  598.     struct LayoutHandle    *PointBack;
  599.  
  600.     LONG             GroupID;
  601.  
  602. #ifdef DO_PICKSHORTCUTS
  603.     UBYTE             Keys[256];
  604. #endif
  605.  
  606.     struct Window        *Parent;        // Parent of this window
  607.     struct Hook        *HelpHook;        // Hook to call when help key is pressed
  608.     LONG             MaxPen;
  609.  
  610.     WORD             SizeWidth;
  611.     WORD             SizeHeight;
  612.  
  613.     BOOLEAN             SizeVerified;
  614.     BOOLEAN          AutoRefresh;
  615.     BOOLEAN          CloseFont;
  616.     BOOLEAN          Failed;
  617.     BOOLEAN          Rescaled;
  618.     BOOLEAN          AutoActivate;
  619.     BOOLEAN          MoveToWindow;
  620.     BOOLEAN             NeedDelay;
  621.     BOOLEAN             RawKeyFilter;
  622.     BOOLEAN             FlushLeft;
  623.     BOOLEAN             FlushTop;
  624.     BOOLEAN             BlockParent;
  625.     BOOLEAN             ExitFlush;
  626.     BOOLEAN             NoKeys;
  627.  
  628. #ifdef DO_CLONING
  629.     struct CloneExtra    *CloneExtra;        // Screen cloning information
  630.     BOOLEAN          CloningPermitted;    // Genetic engineering?
  631.     BOOLEAN          ExactClone;        // Make an exact copy, i.e. preserve all colours
  632.     BOOLEAN             SimpleClone;        // Just a simple clone, please
  633.     BYTE             Pad0;
  634. #endif
  635. } LayoutHandle;
  636.  
  637. #define PHANTOM_GROUP_ID    -10000    // Phantom groups, i.e those without proper
  638.                     // IDs start with this ID
  639.  
  640. /*****************************************************************************/
  641.  
  642.  
  643.     // Window locking
  644.  
  645. typedef struct LockNode
  646. {
  647.     struct MinNode         MinNode;
  648.     struct Window        *Window;
  649.     LONG             Count;
  650.     ULONG             OldIDCMPFlags;
  651.     struct Requester     Requester;
  652.     LONG             MinWidth;
  653.     LONG             MinHeight;
  654.     LONG             MaxWidth;
  655.     LONG             MaxHeight;
  656. } LockNode;
  657.  
  658.  
  659. /*****************************************************************************/
  660.  
  661.  
  662.     // Image class extension
  663.  
  664. typedef struct ImageInfo
  665. {
  666.     STRPTR            *Lines;        // Text lines
  667.     STRPTR             KeyStroke;    // Points to char that acts as keystroke identifier
  668.  
  669.     STRPTR             Label;        // Single label if any
  670.  
  671.     struct TextFont        *Font;        // Open font if any
  672.  
  673.     UWORD             ImageType;    // Type
  674.  
  675.     UWORD             GlyphWidth;    // Size
  676.     UWORD             GlyphHeight;
  677.  
  678.     UWORD             LineCount;    // Number of lines below
  679.  
  680.     BOOLEAN             Emboss;    // Emboss the bevel box
  681. } ImageInfo;
  682.  
  683.     // Image class extension types
  684.  
  685. #define IIA_ImageType    (TAG_USER+739)
  686. #define IIA_GlyphWidth    (TAG_USER+740)
  687. #define IIA_GlyphHeight    (TAG_USER+741)
  688. #define IIA_Lines    (TAG_USER+742)
  689. #define IIA_LineCount    (TAG_USER+743)
  690. #define IIA_KeyStroke    (TAG_USER+744)
  691. #define IIA_Emboss    (TAG_USER+745)
  692. #define IIA_Label    (TAG_USER+746)
  693. #define IIA_Font    (TAG_USER+747)
  694.  
  695.     // Supported image class extension types
  696.  
  697. enum
  698. {
  699.     IMAGECLASS_PICKER,
  700.     IMAGECLASS_LEFTINCREMENTER,
  701.     IMAGECLASS_RIGHTINCREMENTER,
  702.     IMAGECLASS_BACKWARD,
  703.     IMAGECLASS_FORWARD,
  704.     IMAGECLASS_PREVIOUS,
  705.     IMAGECLASS_NEXT,
  706.     IMAGECLASS_RECORD,
  707.     IMAGECLASS_PLAY,
  708.     IMAGECLASS_STOP,
  709.     IMAGECLASS_PAUSE,
  710.     IMAGECLASS_REWIND,
  711.     IMAGECLASS_EJECT,
  712.     IMAGECLASS_MULTILINEBUTTON
  713. };
  714.  
  715.  
  716. /*****************************************************************************/
  717.  
  718.  
  719.     // Level image class
  720.  
  721. typedef struct LevelImageInfo
  722. {
  723.     LONG         Position;    // Position of knob on level body
  724.     LONG         Max;        // Maximum value
  725.     LONG         Current;    // Current value
  726.  
  727.     UWORD        *Pens;        // We don't really need the DrawInfo, just the pens
  728.  
  729.     struct BitMap    *Knob[2];    // BitMaps of the knob
  730.  
  731.     WORD         KnobWidth;    // Width of knob (actually half of it)
  732.     WORD         KnobTop;    // Distance from knob to level body
  733.     WORD         LevelHeight;    // Height of level body
  734. } LevelImageInfo;
  735.  
  736.     // Level class control tags
  737.  
  738. #define LVIA_Current    (TAG_USER+0xF000)    // Current value
  739. #define LVIA_Max    (TAG_USER+0xF001)    // Maximum value
  740. #define LVIA_DrawInfo    (TAG_USER+0xF002)    // Pens, etc.
  741. #define LVIA_Position    (TAG_USER+0xF003)    // Position of knob
  742. #define LVIA_KnobWidth    (TAG_USER+0xF004)    // Width of knob
  743. #define LVIA_FontWidth    (TAG_USER+0xF005)    // Reference font width
  744. #define LVIA_Screen    (TAG_USER+0xF006)    // Screen to draw this image on
  745.  
  746.  
  747. /*****************************************************************************/
  748.  
  749.  
  750. enum
  751. {
  752.     STORAGE_BYTE,STORAGE_UBYTE,
  753.     STORAGE_WORD,STORAGE_UWORD,
  754.     STORAGE_LONG,STORAGE_ULONG,
  755.     STORAGE_STRPTR
  756. };
  757.  
  758.  
  759. /*****************************************************************************/
  760.  
  761.  
  762.     // A single colour in 96 bit precision
  763.  
  764. struct ColourTriplet
  765. {
  766.     ULONG            Red;        // 32 bits each
  767.     ULONG            Green;
  768.     ULONG            Blue;
  769. };
  770.  
  771.     // A colour table ready to submit to LoadRGB32
  772.  
  773. struct ColourRecord
  774. {
  775.     UWORD            NumColours;    // Number of colours in this chunk
  776.     UWORD            FirstColour;    // First colour entry to set
  777.  
  778.     struct ColourTriplet    Triplets[0];    // Table entries
  779.  
  780.     WORD            Arnold;     // Array terminator, needs to be set to zero
  781. };
  782.  
  783.     // Screen reproduction
  784.  
  785. struct CloneExtra
  786. {
  787.     struct Screen        *Screen;
  788.     LONG            *Pens;
  789.     UWORD            *ScreenPens;
  790.     UWORD             MinWidth,
  791.                  MinHeight,
  792.                  MaxWidth,
  793.                  MaxHeight,
  794.                  TotalPens;
  795.     UBYTE             Depth;
  796.     struct IBox         Bounds;
  797. };
  798.  
  799.  
  800. /*****************************************************************************/
  801.  
  802.  
  803. #define ITEMF_HasSub    (1 << 0)        // Next item is a subitem
  804. #define ITEMF_FirstSub    (1 << 1)        // This is the first subitem
  805. #define ITEMF_IsSub    (1 << 2)        // This is a subitem
  806. #define ITEMF_LastItem    (1 << 3)        // This is the last item
  807. #define ITEMF_IsBar    (1 << 4)        // This is a separator bar
  808. #define ITEMF_Command    (1 << 5)        // This item has a long command key sequence
  809.  
  810. typedef struct ItemNode
  811. {
  812.     struct MinNode     Node;
  813.     struct MenuItem     Item;
  814.     APTR         UserData;
  815.     ULONG         ID;            // Item ID
  816.  
  817.     STRPTR         ExtraLabel;        // For long command sequence labels
  818.     UWORD         Flags;            // Flag bits as defined above
  819.     WORD         Left,            // Actual left edge
  820.              Top;            // Actual top edge
  821.     WORD         Width;            // Actual width
  822.  
  823.     UWORD         MenuCode;        // Intuition menu code
  824.  
  825.     ULONG         Qualifier;        // Message qualifier
  826.     UWORD         Code;            // Message code
  827.     UBYTE         Char;            // ASCII code
  828. } ItemNode, *pItemNode;
  829.  
  830. typedef struct MenuNode
  831. {
  832.     struct MinNode     Node;
  833.     struct Menu     Menu;
  834.     APTR         UserData;
  835.     ULONG         ID;            // Item ID
  836.  
  837.     WORD         Width;            // Actual width
  838.  
  839.     UWORD         MenuCode;        // Intuition menu code
  840. } MenuNode, *pMenuNode;
  841.  
  842. typedef struct RootMenu
  843. {
  844.     APTR             Pool;        // Memory allocation
  845.     struct TextFont        *Font;        // Preferred item font
  846.     struct TextAttr        *TextAttr;    // What goes into the single items
  847.     struct TTextAttr     BoldAttr;    // Same as above, just in boldface
  848.     struct DrawInfo        *DrawInfo;    // Screen drawing info
  849.     struct Screen        *Screen;    // The screen we are building the menu for
  850.     struct RastPort         RPort;        // Dummy RastPort for font measuring
  851.  
  852.     WORD             ItemHeight;    // Default item height
  853.     UWORD             TextPen;    // Text rendering pen
  854.  
  855.     ULONG             CheckWidth,    // Size of the checkmark glyph
  856.                  CheckHeight,
  857.                  AmigaWidth,    // Size of the Amiga glyph
  858.                  AmigaHeight;
  859.  
  860.     struct MinList         MenuList;    // List of menus
  861.     struct MinList         ItemList;    // List of menu items
  862.  
  863.     LayoutHandle        *Handle;    // Layout handle if any
  864.     struct Hook        *LocaleHook;    // Localization, if no handle is provided
  865.  
  866.     struct MinNode         Node;        // The initial menu all the data is tied to
  867.     struct Menu         Menu;
  868.     APTR             UserData;
  869.     ULONG             ID;
  870.     WORD             Width;
  871.     UWORD             MenuCode;
  872. } RootMenu, *pRootMenu;
  873.  
  874.  
  875. /*****************************************************************************/
  876.  
  877.  
  878. typedef struct PopInfo
  879. {
  880.     struct CheckGlyph *CheckGlyph;
  881.  
  882.     LONG         MaxLen;
  883.     LONG         MaxWidth;
  884.  
  885.     struct Window    *Window;
  886.     struct TextFont    *Font;
  887.  
  888.     LONG         TopMost;
  889.  
  890.     LONG         LastDrawn;
  891.     LONG         LastLabelDrawn;
  892.  
  893.     STRPTR        *Labels;
  894.     LONG         NumLabels;
  895.     LONG         Active;
  896.     LONG         InitialActive;
  897.     UWORD         ActiveLen;
  898.  
  899.     UWORD         MarkLeft;
  900.     UWORD         MarkWidth;
  901.  
  902.     UWORD         LabelLeft;
  903.     UWORD         LabelTop;
  904.  
  905.     UWORD         LineTop;
  906.  
  907.     UWORD         ArrowTop;
  908.     UWORD         ArrowWidth;
  909.     UWORD         ArrowHeight;
  910.  
  911.     UWORD         PopLeft;
  912.     UWORD         PopWidth;
  913.  
  914.     UWORD         BoxLeft,BoxTop,
  915.              BoxWidth,BoxHeight;
  916.  
  917.     UWORD         BoxLines;
  918.  
  919.     UWORD         SingleWidth,
  920.              SingleHeight;
  921.  
  922.     UWORD         MenuText,MenuBack;
  923.     UWORD         MenuTextSelect,MenuBackSelect;
  924.  
  925.     UBYTE         Flags;
  926.     BOOLEAN         Blocked;
  927.     BOOLEAN         CentreActive;
  928. } PopInfo;
  929.  
  930. #define PIA_Labels        (TAG_USER+0x80000)
  931. #define PIA_Active        (TAG_USER+0x80001)
  932. #define PIA_Font        (TAG_USER+0x80002)
  933. #define PIA_Highlight        (TAG_USER+0x80003)
  934. #define PIA_CentreActive    (TAG_USER+0x80004)
  935.  
  936.  
  937. /*****************************************************************************/
  938.  
  939.  
  940. typedef struct TabEntry
  941. {
  942.     struct BitMap    *BitMap;
  943.     UWORD         Left;
  944. } TabEntry;
  945.  
  946. typedef struct TabInfo
  947. {
  948.     struct BitMap    *BitMap;
  949.     struct RastPort     RPort;
  950.     PLANEPTR     Mask;
  951.     BOOL         ChipMask;
  952.  
  953.     TabEntry    *Tabs;
  954.     WORD         Count;
  955.     WORD         Current;
  956.     WORD         Initial;
  957.  
  958.     UWORD         Thick;
  959.     UWORD         TabWidth;
  960.     UWORD         TabHeight;
  961.  
  962.     WORD         Offset;
  963. } TabInfo;
  964.  
  965. #define TIA_Labels    (TAG_USER+0x90000)
  966. #define TIA_Font    (TAG_USER+0x90001)
  967. #define TIA_Screen    (TAG_USER+0x90002)
  968. #define TIA_Index    (TAG_USER+0x90003)
  969. #define TIA_DrawInfo    (TAG_USER+0x90004)
  970. #define TIA_SizeType    (TAG_USER+0x90005)
  971.  
  972.  
  973. /*****************************************************************************/
  974.  
  975.  
  976. struct CheckGlyph
  977. {
  978.     UWORD         Width,
  979.              Height;
  980.     struct BitMap    *Plain;
  981.     struct BitMap    *Selected;
  982. };
  983.  
  984.  
  985. /*****************************************************************************/
  986.  
  987. /* These may not be defined in the default header files. */
  988.  
  989. #ifndef GDOMAIN_MINIMUM
  990. #define    GDOMAIN_MINIMUM (0)    /* Minimum size */
  991. #endif    /* GDOMAIN_MINIMUM */
  992.  
  993. #ifndef GDOMAIN_NOMINAL
  994. #define    GDOMAIN_NOMINAL    (1)    /* Nominal size */
  995. #endif    /* GDOMAIN_NOMINAL */
  996.  
  997. #ifndef GDOMAIN_MAXIMUM
  998. #define    GDOMAIN_MAXIMUM    (2)    /* Maximum size */
  999. #endif    /* GDOMAIN_MAXIMUM */
  1000.  
  1001.  
  1002. /*****************************************************************************/
  1003.  
  1004.  
  1005. #endif
  1006.